package com.lzp.badminton.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lzp.badminton.model.Activity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzp.badminton.vo.ActivityClubJoin;
import javafx.scene.control.Pagination;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author astupidcoder
 * @since 2022-02-11
 */
@Repository
public interface ActivityMapper extends BaseMapper<Activity> {
    @Select("SELECT at.*, cl.club_cover, cl.club_info, cl.club_master, cl.club_name,cl.club_star, " +
            "cl.club_num, u.user_name, u.user_avatar, u.nickname from activity at, club cl, user u where " +
            "at.club_id = cl.club_id and cl.club_master = u.user_id")
    List<ActivityClubJoin> getActivityInfo(Page<ActivityClubJoin> page);

    @Select("SELECT at.*, cl.club_cover, cl.club_info, cl.club_master, cl.club_name,cl.club_star, " +
            "cl.club_num, u.user_name, u.user_avatar, u.nickname from activity at, club cl, user u where " +
            "at.club_id = cl.club_id and cl.club_master = u.user_id and at.activity_id = #{activityId}")
    ActivityClubJoin getActivityInfoById(@Param("activityId") int activityId);

}
